
<template>
    <div class="card-fill layout-padding">
    <el-card shadow="hover" class="layout-padding-auto" >
        <div>
            <el-select v-model="selectedCodeMessage.chose1" placeholder="故障名称选择">
                <el-option v-for="name in ngPassStationChose.chose1" :key="name.Text" :value="name.Text" :label="name.Text"></el-option>
            </el-select>   

            {{ alertMessage }}

            <div style="text-align:right;">
            <WtmButton @click="onSubmitNGPassStation"  type="primary" :button-text="$t('message.autotrans.SysSubmit')" style="margin-top:15px;"/>
            <WtmButton @click="onCloseNGPassStation"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>
            </div>
    
        </div>
    
    </el-card>
    </div>
</template>
    
    
<script setup lang="ts" name="不良品过站; false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;
import request from '/@/utils/request';


// 定义变量内容
const formRefPassStationRecord = ref();
const ngPassStationChose = reactive({
    chose1: [] as any [],
    chose2: [] as any [],
    chose3: [] as any [],
});
const alertMessage = ref<string>('')

const selectedCodeMessage = ref({
    chose1: null,
    chose2: null,
    chose3: null
})

// 取消
const onCloseNGPassStation = () => {
    closeDialog();
};

// 提交
const onSubmitNGPassStation = () => {
    if(selectedCodeMessage.value.chose1 != null) {
        request({
            url: '/api/BaseInformation/Station/NGPassStation',
            method: 'post',
            data: {
                'LineCode': '',
                'StationCode': ''
        }}).then( res => {
                alertMessage.value = res.mesg
        });

    } else {
        alertMessage.value = '请选择错误信息'
    }
    
};

// 页面加载时
onMounted(() => {
    // 获取当前工序所有错误编码信息
    other.getSelectList('/api/GetData/BadCodeTemplate/GetBadCodes',[],false).then(x=>{ 
        ngPassStationChose.chose1 = x
    });
    
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>